import { defineStore } from "pinia";
import { store } from "@/store";
import { StartChat } from "@/api/lms/knowledge";
import { AddCourse } from "@/api/lms/course";

export const useLmsStore = defineStore({
  id: "lms",
  state: () => ({
    addCoursewareFolderDialog: false, // 添加课件目录的表单
    currNodeId: "", // 当前被点击的课件
    isMe: false, // 是否只看自己的数据
    currCourseInfoDto: {} as any, //当前正在编辑的课件信息
    addCourseForm: {} as AddCourse,
    currStep: 0, // 创建课程，当前是第几步
    dialogForPickCourseware: false,
    pickCourseware: [],
    aiChatCrawerShow: false, //ai聊天抽屉是否显示
    chatArgus: {
      knowledgeId: "0",
      model: "qwen:4b",
      prom: "1",
      query: "",
      temperature: 0,
      referDocNum: 4
    } as StartChat, //聊天参数
    chatHistory: [
      {
        role: "robot",
        msg: "您好，我是traingo知识助手，有什么可以帮到您的呢？",
        docs: [] //引用的文档
      }
    ], //历史聊天记录
    extendChatShow: false // 控制扩展聊天测试框的显示
  })
});

export function useLmsStoreHook() {
  return useLmsStore(store);
}
